package com.dabao.controller;

import com.dabao.util.web.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by dabao on 16/3/1.
 */
public abstract class BaseController {

    protected Logger logger = LoggerFactory.getLogger(this.getClass());

    protected String redirect(String url){
        return "redirect:" + url;
    }

    protected String success(String msg, Object data) {
        Result result = new Result();
        result.setFlag(true);
        result.setMsg(msg);
        result.setData(data);

        return result.toString();
    }

    protected String fail(String msg) {
        Result result = new Result();
        result.setFlag(false);
        result.setMsg(msg);
        return result.toString();
    }
}
